import QtQuick 1.1
import QtMultimediaKit 1.1
import QtMobility.feedback 1.1

Item {
    id: notyfy

    SoundEffect {
        id: sndEffectRecv
        source : "file://"+settings.soundIncomingMessage
    }
    SoundEffect {
        id: sndEffectSent
        source : "file://"+settings.soundOutcomingMessage
    }
    SoundEffect {
        id: sndEffectBuddyLogsIn
        source : "file://"+settings.soundBuddyLogsIn
    }
    SoundEffect {
        id: sndEffectBuddyLogsOut
        source : "file://"+settings.soundBuddyLogsOut
    }
    SoundEffect {
        id: sndEffectSome1SaysYourName
        source : "file://"+settings.soundChatSomeoneSaysMyName
    }
    SoundEffect {
        id: sndEffectChatOthersTalk
        source : "file://"+settings.soundChatOthersTalk
    }

    HapticsEffect {
        id: hapticsEffectRecvMsg
        attackIntensity: 0
        attackTime: 250
        intensity: 1.0
        duration: 800 // set up the duration here, in millisecond
        fadeTime: 250
        fadeIntensity: 0
        running: false
    }

    HapticsEffect {
        id: hapticsEffectSentMsg
        attackIntensity: 0
        attackTime: 250
        intensity: 1.0
        duration: 400
        fadeTime: 250
        fadeIntensity: 0
        running: false
    }

    HapticsEffect {
        id: hapticsEffectBuddyLogsIn
        attackIntensity: 0.1
        attackTime: 500
        intensity: 1.0
        duration: 400
        fadeTime: 0
        fadeIntensity: 0
        running: false
    }

    function notifyMessageRecv() {
        if( settings.vibrationMessageReceived ) {
            hapticsEffectRecvMsg.running = true
        }
        sndEffectRecv.play()
    }

    function notifyMessageSent() {
        if( settings.vibrationMessageSent ) {
            hapticsEffectSentMsg.running = true
        }
        sndEffectSent.play()
    }

    function notifyBuddyLogsIn() {
        sndEffectBuddyLogsIn.play()
    }

    function notifyBuddyLogsOut() {
        sndEffectBuddyLogsOut.play()
    }

    function notifyChatSomeoneSaysMyName() {
        if( settings.vibrationChatSomeoneSaysMyName ) {
            hapticsEffectRecvMsg.running = true
        }
        sndEffectSome1SaysYourName.play()
    }

    function notifyChatOthersTalk() {
        if( settings.vibrationChatOthersTalk ) {
            hapticsEffectSentMsg.running = true
        }
        sndEffectChatOthersTalk.play()
    }
}
